package com.easygoods.base;

import com.bestvike.stone.core.time.DateUtils;
import lombok.Data;

import javax.persistence.Id;
import java.util.Date;

/**
 * Created by 许崇雷 on 2018-12-24.
 */
@Data
public class BaseEntity {
    public static final String ID = "id";
    public static final String CREATE_TIME = "createTime";
    public static final String UPDATE_TIME = "updateTime";

    @Id
    private String id;
    private Date createTime;
    private Date updateTime;

    public void beforeInsert() {
        this.createTime = DateUtils.now();
        this.updateTime = DateUtils.now();
    }

    public void beforeUpdate() {
        this.updateTime = DateUtils.now();
    }
}
